home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / reqtoolsdev.lha / ReqTools / Glue / GCC / gcc_glue.lha / lib / c.s next >
Text File  |  1994-04-19  |  2KB  |  99 lines

  1.  
  2. | stripped not baserelative startup code for gcc v2.3.3
  3. | (c) by Gunther Nikl Die Jan 11 17:44 1994
  4. | No really bugs known
  5.  
  6. | some specific defines
  7.  
  8. _LVOForbid    =    -132
  9. _LVOGetMsg    =    -372
  10. _LVOReplyMsg    =    -378
  11. _LVOWaitPort    =    -384
  12. _LVOCloseLibrary =    -414
  13. _LVOOpenLibrary    =    -552
  14.  
  15. _LVOCurrentDir    =    -126
  16.  
  17. | public symbols
  18.  
  19.         .globl    __exit
  20.  
  21.         .text
  22.  
  23. | first entry - init some vars, check for cli or wb start
  24.  
  25. start:        moveml    d2-d7/a2-a6,sp@-
  26.  
  27.         movel    sp,_SaveSP
  28.         movel    4:W,a6
  29.         movel    a6,_SysBase
  30.  
  31.         movel    a6@(276),a3
  32.         tstl    a3@(172)
  33.         bnes    fromCLI
  34.  
  35. | wb start - get wbmsg, open dos, change dir
  36.  
  37. fromWB:        lea    a3@(92),a0
  38.         jsr    a6@(_LVOWaitPort)
  39.         lea    a3@(92),a0
  40.         jsr    a6@(_LVOGetMsg)
  41.         movel    d0,_WbMsg
  42.  
  43. | cli start - open dos
  44.  
  45. fromCLI:    jbsrs    OpenDOS
  46.         beqs    cleanup
  47.         movel    _WbMsg,d1
  48.         beqs    isCLI
  49.         movel    d1,a1
  50.         movel    a1@(36),a1
  51.         movel    a1@,d1
  52.         jsr    a6@(_LVOCurrentDir)
  53. isCLI:        jbsr    __main
  54.         jras    cleanup
  55.  
  56. | exit() entry - get return val, restore stackptr
  57.  
  58. __exit:        movel    sp@(4:W),d0
  59.         movel    _SaveSP,sp
  60.  
  61. | cleanup - close dos, reply wbmsg
  62.  
  63. cleanup:    movel    d0,d7
  64.         movel    _SysBase,a6
  65.         movel    _DOSBase,d0
  66.         beqs    nodos
  67.         movel    d0,a1
  68.         jsr    a6@(_LVOCloseLibrary)
  69. nodos:        movel    _WbMsg,d2
  70.         beqs    todos
  71.         jsr    a6@(_LVOForbid)
  72.         movel    d2,a1
  73.         jsr    a6@(_LVOReplyMsg)
  74. todos:        movel    d7,d0
  75.         moveml    sp@+,d2-d7/a2-a6
  76.         rts
  77.  
  78. | open dos v33+
  79.  
  80. OpenDOS:    lea    pc@(DosName+2),a1
  81.         movql    #33,d0
  82.         jsr    a6@(_LVOOpenLibrary)
  83.         movel    d0,a6
  84.         movel    a6,_DOSBase
  85.         rts
  86.  
  87. DosName:    .asciz    "dos.library"
  88.  
  89.         .even
  90.  
  91. | data area
  92.  
  93.         .data
  94.  
  95. .comm        _SysBase,4
  96. .comm        _DOSBase,4
  97. .comm        _SaveSP,4
  98. .comm        _WbMsg,4
  99.